import { prisma } from "@/app/util/prisma"
import { NextResponse } from "next/server"

export const GET = () => {
  return NextResponse.json({
    success: true,
    message: '成功',
    data: [
      {
        title: '123'
      }
    ]
  })
}

export async function POST (request: NextResponse) {
  const { title, content, view, createTime, tag } = await request.json()
  const res = await prisma.article.create({
    data: {
      title, content, view, createTime, tag
    }
  })
  return NextResponse.json(res, { status: 200 })
}

